package top.kaoshanji.p1ch06a;

/**
 * 代码清单-p1ch06a-123页a：演示初始化顺序
 * author kaoshanji
 * ^_^
 * create time 2025/3/8 17:25
 */
public class OrderOfInitialization {

    public static void main(String[] args) {
        House h = new House();
        h.f();
    }

}

class Window {
    Window(int marker) {
        System.out.println("Window(" + marker + ")");
    }
}

class House {
    Window w1 = new Window(1); // 在构造器之前

    House () {
        // 提示已经在构造器里
        System.out.println("House()");
        w3 = new Window(33); // 重新初始化 w3

    }

    Window w2 = new Window(2); // 在构造器之后

    void f() {
        System.out.println("f()");
    }

    Window w3 = new Window(3); // 在尾部


}
